var MyQueue = function() {
    this.inbox = [];
    this.outbox = [];
};

MyQueue.prototype.push = function(x) {
    this.inbox.push(x)
};

MyQueue.prototype.pop = function() {
    while (this.inbox.length) {
        this.outbox.push(this.inbox.pop());
    }
    var first = this.outbox.pop();
    while (this.outbox.length) {
        this.inbox.push(this.outbox.pop());
    }
    return first;
};

MyQueue.prototype.peek = function() {
    return this.inbox[0];
};

MyQueue.prototype.empty = function() {
    return this.inbox.length === 0;
};